<template>
  <div class="dashboard-container">
    <div class="app-container">
      <el-card class="box-card">
        <el-table
          :data="tableData"
          style="width: 100%"
          border
          height="700"
        >
          <el-table-column
            type="index"
            width="50"
            label="#"
          />
          <el-table-column
            prop="authName"
            label="权限名称"
          />
          <el-table-column
            prop="path"
            label="路径"
          />
          <el-table-column
            prop="level"
            label="标签"
          >
            <template slot-scope="scope">
              <el-tag
                v-if="scope.row.level === '0'"
                size="small"
              >一级</el-tag>
              <el-tag
                v-else-if="scope.row.level === '1'"
                type="success"
                size="small"
              >二级</el-tag>
              <el-tag
                v-else
                type="warning"
                size="small"
              >三级</el-tag>
            </template>
          </el-table-column>
        </el-table>
      </el-card>
    </div>
  </div>
</template>

<script>
import { getTypeListTree } from '@/api/jurisdiction.js'
export default {
  data() {
    return {
      // 权限表单数据
      tableData: [],
      // 请求表格类型
      listOrTree: 'list'
    }
  },

  created() {
    this.allTypeListTree()
  },

  methods: {
    async allTypeListTree() {
      const res = await getTypeListTree(this.listOrTree)
      this.tableData = res
      console.log(res)
    },
    filterTag(value, row) {
      console.log(value)
      console.log(row)
      return row.level === value
    }
  }
}
</script>

<style scoped lang='less'>

</style>
